$(function(){
	$('#signIn').on('click',adminLogin);
});

//用户登录
function adminLogin(){
	var adminName = $('#adminName').val();
	var password = $('#adminPassword').val();
	var returnUrl = $('#returnUrl').val();
	
	$.ajax({
		type : "POST",
		url : "/loginAdmin/loginCheck",
		async : false,
		data : {
			adminName : adminName,
			password : password 
		},
		dataType: 'json',
		success:function(data){
			if(data.isSuccess == "ok") {
				if(returnUrl != ''){
					location.href = returnUrl;
				}else{
					location.href = "/userAdmin/userList";
				}
				
			}else if(data.isSuccess == "adminUserError") {
				BSTYUN.dialog.warn("<span style='color:#000;'>用户不存在！</span>");
			}else if(data.isSuccess == "passwordError") {
				BSTYUN.dialog.warn("<span style='color:#000;'>密码错误！</span>");
			}else if(data.isSuccess == "adminUserInvalid"){
				BSTYUN.dialog.warn("<span style='color:#000;'>用户无效！</span>");
			}
		}
	});
}
/**
 * 敲击回车键提交表单
 */
function keyLogin(){
	if(event.keyCode == 13){
		adminLogin();
	}
}





